package comgame.components.EquipmentComponent;

import com.almasb.fxgl.dsl.FXGL;
import comgame.entities.EquipmentEnum.SwordType;
import comgame.components.AttributeComponent;

public class SwordComponent extends EquipmentComponent {
    private final SwordType swordType;
    private String displayName;

    public SwordComponent(SwordType swordType) {
        super(swordType);
        this.swordType = swordType;
    }
    public int getAttack() {
        return swordType.getAttack();
    }
    public int getDefense() {
        return swordType.getDefense();
    }
    public int getSpeed() {
        return swordType.getSpeed();
    }
    public double getCritRate() {
        return swordType.getCritRate();
    }
    public void setDisplayName(String name) {
        this.displayName = name;
    }
    public String getDisplayName() {
        return displayName != null ? displayName : swordType.getName();
    }

    @Override
    public void onAdded() {
        AttributeComponent attr = entity.getComponent(AttributeComponent.class);
        if (attr != null) {
        }
    }

    @Override
    public void onRemoved() {
        AttributeComponent attr = entity.getComponent(AttributeComponent.class);
        if (attr != null) {
        }
    }
}